package com.gxa.autoparts.core.util;
import com.gxa.autoparts.core.common.JsonResult;

import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

import java.net.URI;
import java.net.URISyntaxException;


public class RestUtil {

    private static RestTemplate restTemplate = new RestTemplate();

    public static JsonResult postWithParams(String uri, MultiValueMap<String, Object> paramMap) throws URISyntaxException {
        return restTemplate.postForObject(new URI(uri), paramMap, JsonResult.class);
    }
    public static JsonResult postWithOutParams(String uri) throws URISyntaxException {


        return restTemplate.postForObject(new URI(uri), null, JsonResult.class);
    }
}

